package com.decent.web.system.service.impl;

import com.decent.common.bo.MessageBean;
import com.decent.web.system.dao.SystemBrandDao;
import com.decent.web.system.dto.SystemBrandDTO;
import com.decent.web.system.service.SystemBrandService;
import com.decent.web.system.vo.SystemBrandVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: decent Gjh
 * @date: 2022/10/25/18:35
 * @description:
 */
@Service
@Slf4j
public class SystemBrandServiceImpl implements SystemBrandService {
    private final SystemBrandDao brandDao;

    public SystemBrandServiceImpl(SystemBrandDao brandDao) {
        this.brandDao = brandDao;
    }

    /**
     * 查找品牌
     * @param brandDTO 接收参数
     * @return 品牌列表
     */
    @Override
    public MessageBean selectBrand(SystemBrandDTO brandDTO) {
        List<SystemBrandVO> classifies = brandDao.selectBrand(brandDTO);
        if (classifies==null||classifies.isEmpty()) {
            return MessageBean.success("暂无数据");
        }
        return MessageBean.success(classifies);
    }

    /**
     * 获取热门品牌
     * @return 品牌列表
     */
    @Override
    public MessageBean selectHotBrand() {
        List<SystemBrandVO> brands = brandDao.getHot();
        return MessageBean.success(brands);
    }

}
